<!DOCTYPE html>
<html>
<head>
 <include file="public:header" />
 <title>讨论</title>
</head>

<body>
<include file="public:logo" />
<div class="uu_spacing"></div>

 
<div class="top-menu">
  <div class="lay"></div>
		<div class="top-menu-list">
		  
		  <a  href="{:U('bbs/lists')}" class="tbtn <if condition="$Think.get.cat eq ''">select</if>">全部</a>
			<ytata:cat listname="li" type="bbs" pid="0" />
			  <volist name="li.list" id="li">
			  <a href="{$li.burl}" class="tbtn <eq name="Think.get.cat" value="$li['c_id']">select</eq>">{$li.c_title}</a>
			  </volist>
  </div>
  <!--将选中的分类放置到全部后面的第一位 -->
  <script>
  var selObj = $('.top-menu-list .select');
  selObj.clone().insertAfter($(".top-menu-list").find('a').eq(0));
  selObj.remove();
  </script>
		
</div>
 
<if condition="$Think.get.cat gt 0 ">
<ytata:cat listname="li" pid="$_GET['cat']"  />
<notempty name="li.list">
<div class="top-menu-s">
<a  href="{:U('bbs/lists',array('cat'=>$_GET['cat']))}" class=" font12 tbtn <if condition="$Think.get.cat1 eq ''">select</if>">全部</a>
        
        <volist name="li.list" id="li">
          <a href="{$li.burl}" class="tbtn font12 <eq name="Think.get.cat1" value="$li['c_id']">select</eq>">{$li.c_title}</a>
        </volist>
</div>
</notempty>

</if>

<div class="uu_spacing"></div>

<div class="comadd">
  <div   class="addbtn font14 J_adddata_btn">发帖</div>
  
  <div class="selbox font12"  id="J_sort">
 {$_GET['sort_tit'] ? $_GET['sort_tit'] : '新回复'}
  </div>
</div>
 

<div id="listData">
<include file="ajax_bbs_list" />
</div>
 
<div class="add_date_btn J_adddata_btn" draggable="true"><!--浮动的添加按钮 --></div>
<include file="public:foot" />
<include file="public:photoswipe" />

</body>

<script>
  // 发布
      $(".J_adddata_btn").click(function () {
          var params = {t:'ttt'};
          ajax_login('ajax_bbs_add', params);
      });
	   // 列表排序
      $("#J_sort").on('click', function () {
          $.getJSON('{:query_url("Ajax/ajax_bbs_sort")}', function (result) {
              if (result.code === 0) {
                  toast(result.msg);
                  return;
              }
              popout = new YTATApopout({
                  title: '选择分类',
                  showFooter: false,
                  whetherClose: true,
                  emptyClose: false,
                  noPadding: false,
                  noBackground: false
              });

              popout.setContent(result.data);
              popout.show();
          });
      });
 
 
 
      var loadurl = "{:query_url('bbs/ajax_bbs_list',array('p'=>2))}";
      $('#listData').dropload({
          scrollArea : window,
          loadDownFn : function(me){
		  $.getJSON(loadurl, function (result) {
				  if (result.code === 0) {
					  me.lock();
					  me.noData();
					  me.resetload();
					  return;
				  }
				  else if (result.code === 1) {
						  var ret = result.data;
						  $("#listData .dropload-down").before(ret.html);
						  loadurl = ret.loadurl;
						  me.resetload();
				  }else{
					alert('Ajax Error!');
					me.resetload();
				  }
              });
          }
      });
      
  // 添加帖子
  function ajax_bbs_add(params) {
    var ajax_addbbs_url = '{:U("ajax_bbs_add")}';
    $.getJSON(ajax_addbbs_url, params, function (result) {
        if (result.code == 1) {
            show_form('发贴',result.data);
            $('.uu_forms').addClass('uu-actionsheet-toggle');
        } else if (result.code == 0) {
            toast(result.msg);
        }
    });
  }
  
  
  
</script>
</html>